package com.multi.thread.chapter01;

public class ExtendThread extends Thread {

	@Override
	public void run() {
		try {
			for (int i = 0; i < 10; i++) {
				int time  = (int) (Math.random() * 1000);
				Thread.sleep(time);
				System.out.println("Run 1 =" + Thread.currentThread().getName());
			}
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
	
	public static void main(String[] args) {
		ExtendThread myThread = new ExtendThread();
		myThread.setName("myThread");
		myThread.start();
		
		try {
			for (int i = 0; i < 10; i++) {
				int time  = (int) (Math.random() * 1000);
				Thread.sleep(time);
				System.out.println("Run=" + Thread.currentThread().getName());
			}
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

}
